/*
 * Copyright © 2016 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

@import "../../styles/variables.scss";
@import "../../styles/colors.scss";

.market-place-package-card {
  margin: 5px;
  box-shadow: 1px 2px 10px 0 rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  position: relative;
  width: 100%;
  display: flex;

  > span {
    width: 100%;
    display: flex;
  }

  &:hover {
    box-shadow: 1px 2px 10px 0 var(--brand-primary-color);
  }

  /*
    width of each card = 100% - (padding of parent) - (combined margin of all cards in the row)
    margin for each card is 5px (as mentioned above).
    So the combined margin for all cards in say ,
      4 column layout : 5px + (5px + 5px) + (5px + 5px) + 5px = (3 * 10px)
      5 column layout : 5px + (5px + 5px) + (5px + 5px) + (5px + 5px) + 5px = (4 * 10px)
      6 column layout : 5px + (5px + 5px) + (5px + 5px) + (5px + 5px) + (5px + 5px) + 5px = (5 * 10px)
      n column layout : (n-1 * 10px);
  */
  @media (min-width: 1601px) {
    width: calc((100% - 20px - 10px - (5 * 10px)) / 6);
  }

  @media (min-width: 1201px) and (max-width: 1600px) {
    width: calc((100% - 20px - 10px - (3 * 10px)) / 4);
  }

  @media (min-width: 993px) and (max-width: 1200px) {
    width: calc((100% - 20px - 10px - (2 * 10px)) / 3);
  }

  @media (min-width: 768px) and (max-width: 992px) {
    width: calc((100% - 20px - 10px - 10px) / 2);
  }

  .cask-card {
    width: 100%;
    display: flex;
    justify-content: center;

    padding: 0;
    .card-body {
      width: 100%;
      display: flex;
      padding-top: 25px;
      flex-direction: column;
    }
  }

  .banners {
    top: -20px;
    left: -15px;
    position: relative;
  }

  .banners-shifted {
    top: -20px;
    left: -25px;
    position: relative;
  }

  .package-icon-container {
    // This is to maintain a consistent height across all entities
    // as the image sizes could be differing.
    height: 87px;
    overflow: hidden;
    img {
      width: 87px;
    }

    &.beta {
      margin-top: -17px;
    }
    [class*="icon-"] {
      line-height: 87px;
      font-size: 60px;
      width: 87px;
      display: inline-block;
      text-align: center;
    }
  }
  .package-metadata-container {
    margin-top: 5px;
    flex: 1 1 auto;

    .package-label {
      font-size: 14px;
      font-weight: bold;
    }
  }
  &.expanded {
    cursor: default;

    .cask-card {
      &.card-LG {
        z-index: 2;

        .card-body {
          width: 100%;
          height: auto;
          z-index: 2;
          background: $grey-09;
          text-align: left;
          box-shadow: 2px 2px 7px;

          .package-metadata-container {
            margin-bottom: 10px;
          }
        }
      }
    }
    &.position-right {
      .cask-card.card-LG {
        right: 0px;
        margin-bottom: 20px;
        .card-body {
          .package-icon-container {
            float: right;
            margin-right: 0;
          }
        }
      }
    }
    &.position-left {
      .cask-card.card-LG {
        left: 0px;
        margin-bottom: 20px;
      }
    }
    .package-icon-container {
      display: inline-block;
      vertical-align: top;
      margin-right: 20px;
    }
    .package-metadata-container {
      display: inline-block;
      width: calc(100% - 145px);

      > .package-label {
        font-size: 17px;
      }
      .package-metadata {
        margin-top: 10px;
      }
    }
    .package-footer {
      margin-top: 10px;
      button {
        margin-left: 10px;
      }
    }

    .package-animation-appear {
      opacity: 0.01;
      transition: opacity 300ms ease-in;
    }

    .package-animation-appear.package-animation-appear-active {
      opacity: 1;
    }

    .package-animation-enter {
      opacity: 0.01;
    }

    .package-animation-enter.package-animation-enter-active {
      opacity: 1;
      transition: opacity 500ms ease-in;
    }

    .package-animation-leave {
      opacity: 1;
    }

    .package-animation-leave.package-animation-leave-active {
      opacity: 0.01;
      transition: opacity 300ms ease-in;
    }
  }
}

.banners,
.banners-shifted {
  height: 18px;
  display: inline-flex;
  text-align: center;
}

.additional-charges-header {
  font-weight: bold;
  margin-bottom: 0;
}
